import request from './request';

export const getUsers = (params) => request({
  method: 'get',
  url: '/users',
  params,
});

export const getUser = (id) => request({
  method: 'get',
  url: `/users/${id}`,
});

export const editUser = (id, data) => request({
  method: 'put',
  url: `/users/${id}`,
  data,
});

export const delUser = (id) => request({
  method: 'delete',
  url: `/users/${id}`,
});

export const addUser = (data) => request({
  method: 'post',
  url: '/users',
  data,
});

export const fieldExist = (field, value) => request({
  method: 'get',
  url: '/users/exist',
  params: {
    field,
    value,
  },
});

export default {};
